# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is dual-licensed under either the MIT license found in the
# LICENSE-MIT file in the root directory of this source tree or the Apache
# License, Version 2.0 found in the LICENSE-APACHE file in the root directory
# of this source tree. You may select, at your option, one of the
# above-listed licenses.

# pyre-strict

from buck2.tests.e2e_util.api.buck import Buck
from buck2.tests.e2e_util.buck_workspace import buck_test


@buck_test(inplace=False, data_dir="bxl/simple")
async def test_cquery_eval(buck: Buck) -> None:
    result = await buck.bxl(
        "//bxl:lazy_cquery.bxl:eval_query_test",
    )

    assert "TARGETS.fixture" in result.stdout


@buck_test(inplace=False, data_dir="bxl/simple")
async def test_eval_query_catch_error(buck: Buck) -> None:
    await buck.bxl(
        "//bxl:lazy_cquery.bxl:eval_query_catch_error_test",
    )
